home *** CD-ROM | disk | FTP | other *** search
- Path: hermes.oc.com!usenet
- From: Larry Weiss <lfw@oc.com>
- Newsgroups: comp.lang.c
- Subject: Re: && operator question
- Date: Thu, 15 Feb 1996 15:50:49 -0600
- Organization: OpenConnect Systems, Dallas, TX, USA
- Message-ID: <3123AAB9.FBE@oc.com>
- References: <4fu69a$b7e@sphinx.Gsu.EDU> <31236240.1417@oc.com> <fcusack-1502961453260001@mudskipper.cac.psu.edu>
- NNTP-Posting-Host: ocs2228.oc.com
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0 (Win16; I)
- CC: lfw@oc.com
-
- frank. wrote:
- >
- > In article <31236240.1417@oc.com>, Larry Weiss <lfw@oc.com> wrote:
- >
- > > Matthew A Johnson wrote:
- > > > if(expression1 && expression2)
- > > > some statement;
- > > > My question is, if expression1 is false will expression2 get evaluated at
- > > > all?
-
- > > No. Why do you ask that question here?
-
- > Why wouldn't he ask it here? It is a C question...
-
-
- I am trying to understand why someone would go to the trouble (and have the
- patience) to ask such a trivial question that could easily be answered by
- consultation to any C language textbook.
-
- I have a slightly hidden agenda as well by posting this reply in the newsgroup
- ....that is the general education of the infrequent readers of this group....
- that such simple questions should first be resolved privately. Or at least,
- disquise the question in sheep's clothing....for example:
-
- Why is C designed to require short circuit evaluation with respect to
- some operators (for instance &&) ?
-
- Isn't C somewhat unique in mandating short circuit evaluation for the
- logical AND (&&) operator? BASIC and FORTRAN don't do this.
-
- Why did the designers of C mandate the short circuit evaluation of the
- && operator?
-
- That way, you'll be quickly informed if your assumption is incorrect
- (you get to ask the question) and be much less likely to get "educated"
- about the nettiquete issues. You also just might learn some background
- about the C language, as well as the operational realities. But better
- by far to just read a book (you'll get the answer instantly).
-